*****************************
**MODELS OF WAR TERMINATION**
*****************************

**One-Year Break**
*All Conflicts 
stset duration, id(dyadep) failure(warends == 1)
stcox rebelext2 lnt_rebelext rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid)  texp(ln(_t)) tvc(secession lnpop)
estimates store m1
nonph_graph combined_coefficient 90

*Government Victory
stset duration, id(dyadep) failure(outcome_st == 1)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st = 2,3,4,5) texp(ln(_t)) tvc(activedyads)
estimates store m2

*Low Activity
stset duration, id(dyadep) failure(outcome_st == 2)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st = 1,3,4,5)
estimates store m3

*Settlement
stset duration, id(dyadep) failure(outcome_st == 3)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st = 1,2,4,5) texp(ln(_t)) tvc(rebstrength2)
estimates store m4

*Rebel Victory
stset duration, id(dyadep) failure(outcome_st == 4)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st = 1,2,3,5) texp(ln(_t)) tvc(activedyads)
estimates store m5

estout m1 m2 m3 m4 m5, cells(b (star fmt(%9.3f)) p(par)) stats(N N_sub N_fail chi2 ll , star fmt(%9.3f %9.0g)) eform

**Three-Year Break**
*All Conflicts 
stset duration3, id(dyadep3) failure(warends3 == 1)
stcox rebelext2 lnt_rebelext rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) texp(ln(_t)) tvc( polity2 lnseverity)
estimates store m1

*Government Victory
stset duration3, id(dyadep3) failure(outcome_st3 == 1)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st3 = 2,3,4,5) texp(ln(_t)) tvc(lnseverity activedyads)
estimates store m2

*Low Activity
stset duration3, id(dyadep3) failure(outcome_st3 == 2)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st3 = 1,3,4,5) texp(ln(_t)) tvc(rebstrength2 polity2)
estimates store m3

*Settlement
stset duration3, id(dyadep3) failure(outcome_st3 == 3)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st3 = 1,2,4,5)
estimates store m4

*Rebel Victory
stset duration3, id(dyadep3) failure(outcome_st3 == 4)
stcrreg rebelext2 rebstrength2 terrcont lnmilpers_ipop polity2 lnseverity secession activedyads lnpop if coup == 0 , r cluster(dyadid) compete(outcome_st3 = 1,2,3,5) texp(ln(_t)) tvc(activedyads)
estimates store m5

estout m1 m2 m3 m4 m5, cells(b (star fmt(%9.3f)) p(par)) stats(N N_sub N_fail chi2 ll , star fmt(%9.3f %9.0g)) eform

**********************************************	
**MODELS OF PEACE TERMINATION/WAR RECURRENCE**
**********************************************

*One-Year Break
stset peaceduration, id(peacedyad) failure(failure = 1)
stcox rebelext2_recur secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m1
stcox rebelext2_recur lowactivity govvict secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m2 
stcox govvict_reb govvict_noreb lowactivity secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m3
stcox lowact_reb lowact_noreb govvict secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m4

estout m1 m2 m3 m4, cells(b (star fmt(%9.3f)) p(par)) stats(N N_sub N_fail chi2 ll , star fmt(%9.3f %9.0g)) eform

*Three-year break
stset peaceduration3, id(peacedyad3) failure(failure3 = 1)
stcox rebelext2_recur3 secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m1
stcox rebelext2_recur3 lowactivity govvict secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m2
stcox govvict_reb govvict_noreb lowactivity secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m3
stcox lowact_reb lowact_noreb govvict secession lnsumseverity3 lnduration3 lnpop polity2 activedyads if outcome != 6, r cluster(dyadid)
estimates store m4

estout m1 m2 m3 m4, cells(b (star fmt(%9.3f)) p(par)) stats(N N_sub N_fail chi2 ll , star fmt(%9.3f %9.0g)) eform


**********************************************
**MODELS OF SUCCESSFUL DECAPITATION ATTEMPTS**
**********************************************

*Leader
logit success founder lnpop lnseverity lnduration3, r cluster(dyadid)
estimates store m1
logit success killed lnpop lnseverity lnduration3, r cluster(dyadid)
*Organizational Structure
logit success strengthcent2 lnpop lnseverity lnduration3, r cluster(dyadid) 
logit success rebpolwing2 lnpop lnseverity lnduration3,  r cluster(dyadid) 
logit success lnrebest lnpop lnseverity lnduration3, r cluster(dyadid)
*Popular Support
logit success mobcap2 lnpop lnseverity lnduration3, r cluster(dyadid) 
logit success islamist lnpop lnseverity lnduration3, r cluster(dyadid)
estimates store m2
*resources
logit success transconstsupp2 lnpop lnseverity lnduration3, r cluster(dyadid)
estimates store m3
logit success rebextpart2 lnpop lnseverity lnduration3, r cluster(dyadid)
estimates store m4
logit success rebelsupport2 lnpop lnseverity lnduration3, r cluster(dyadid)

coefplot m1 m2 m3 m4, drop(lnpop lnseverity lnduration3 _cons) xline(0) graphregion(color(white))
